import express = require('express')
const router = express.Router();

router.get('/', (req:any, res: any) => {
  res.status(200).json({
    message: "It works!!!"
  })
})

router.post('/', (req, res,) => {
  res.status(200).json({
    message: 'Handling POST requests to /products!'
  })
})

router.get('/:productId', (req, res, next) => {
  const id = req.params.productId;
  if (id === 'good') {
    res.status(200).json({
      message: 'good man!',
      id
    });
  } else {
    res.status(200).json({
      message: 'no promisson'
    })
  }
})

module.exports = router;
